package ru.spies.work;

import javax.servlet.http.HttpServletRequest;

import ru.spies.dbwork.DBWork;
import ru.spies.requests.AddRequestWork;

public class AddWork  extends AbstractWork{
	
	private static AddWork statThis=null;

	private AddWork() {
		
	}
	
	public static AddWork getInstance(){
		if (statThis==null){
			statThis = new AddWork();
		}
		return statThis;
	}

	@Override
	protected void doWorkWithAgent(HttpServletRequest request) {
		DBWork.getInstance().updateTableObject(AddRequestWork.getInstance().addAgent(request));
	}

	@Override
	protected void doWorkWithAgentAndTask(HttpServletRequest request) {
		DBWork.getInstance().addPersistTableObject(AddRequestWork.getInstance().addAgentAndTask(request));	
	}

	@Override
	protected void doWorkWithCountry(HttpServletRequest request) {
		DBWork.getInstance().addPersistTableObject(AddRequestWork.getInstance().addCountry(request));
	}

	@Override
	protected void doWorkWithDepartment(HttpServletRequest request) {
		DBWork.getInstance().updateTableObject(AddRequestWork.getInstance().addDepartment(request));
	}

	@Override
	protected void doWorkWithDocument(HttpServletRequest request) {
		DBWork.getInstance().updateTableObject(AddRequestWork.getInstance().addDocument(request));		
	}

	@Override
	protected void doWorkWithImportance(HttpServletRequest request) {
		DBWork.getInstance().addPersistTableObject(AddRequestWork.getInstance().addImportance(request));		
	}

	@Override
	protected void doWorkWithTask(HttpServletRequest request) {
		DBWork.getInstance().updateTableObject(AddRequestWork.getInstance().addTask(request));
	}

	@Override
	protected void doWorkWithTaskType(HttpServletRequest request) {
		DBWork.getInstance().addPersistTableObject(AddRequestWork.getInstance().addTaskType(request));	
	}


}
